home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / vol15n10.zip / WHATIS.ZIP / WHATISIT.SCR < prev   
Text File  |  1995-12-26  |  5KB  |  107 lines

  1. n WHATISIT.COM
  2. a 100
  3. XOR     CX,CX              ;     CX = 0
  4. MOV     SI,0080            ;     SI -> command line storage in PSP.
  5. MOV     CL,[SI]            ;     CX = length of command line.
  6. INC     SI                 ;0107 (Start of scan loop)
  7. CMP     BYTE PTR [SI],20   ;     Space?
  8. JZ      0112               ;     Skip if so.
  9. CMP     BYTE PTR [SI],09   ;     Tab?
  10. JNZ     0117               ;     Skip if not
  11. LOOP    0107               ;0112 Loop back to SCAN1
  12. JMP     01CE               ;     Error if command line empty.
  13. MOV     DX,SI              ;     Save start of parm.
  14. INC     SI                 ;0119 (Second scan loop)
  15. CMP     BYTE PTR [SI],20   ;     Space?
  16. JZ      0130               ;     Skip if so.
  17. CMP     BYTE PTR [SI],09   ;     Tab?
  18. JZ      0130               ;     Skip if so.
  19. CMP     BYTE PTR [SI],0A   ;     Line feed?
  20. JZ      0130               ;     Skip if so.
  21. CMP     BYTE PTR [SI],0D   ;     Carriage return?
  22. JZ      0130               ;     Skip if so.
  23. LOOP    0119               ;     Loop back to SCAN2.
  24. MOV     BYTE PTR [SI],00   ;0130 Terminate with NULL
  25. MOV     SI,0204            ;     SI -> buffer
  26. MOV     AX,3D80            ;     DOS File Open function.
  27. INT     21
  28. JNB     0140               ;     Skip if succesful.
  29. JMP     01C2               ;     Error if not.
  30. MOV     BX,AX              ;0140 BX = file handle.
  31. XOR     CX,CX              ;     CX:DX = 0000:003Ch
  32. MOV     DX,003C            ;      (Pointer to Windows header)
  33. CALL    01A3               ;     Seek
  34. MOV     CX,0002            ;     Read WORD from file.
  35. CALL    01AB
  36. MOV     DX,[SI]            ;     DX = offset to Windows header
  37. MOV     DI,DX              ;     Save offset in DI
  38. XOR     CX,CX              ;     CX = 0
  39. CALL    01A3               ;     Seek to Windows header.
  40. MOV     CX,0002            ;     Read two bytes.
  41. CALL    01AB
  42. CMP     WORD PTR [SI],454E ;     Should be "NE",
  43. JNZ     01B5               ;     otherwise not a Win executable.
  44. MOV     DX,002C            ;     Seek to offset 2CH from
  45. ADD     DX,DI              ;       start of Windows header.
  46. XOR     CX,CX
  47. CALL    01A3
  48. MOV     CX,0004            ;     Read DWORD from file (pointer to
  49. CALL    01AB               ;     non-resident name table)
  50. MOV     DX,[SI]            ;     CX:DX = offset.
  51. MOV     CX,[SI+02]
  52. CALL    01A3               ;     Seek to non-resident name table.
  53. MOV     CX,0001            ;     Read 1 byte (length of first string)
  54. CALL    01AB
  55. XOR     CH,CH              ;     CX = length of string.
  56. MOV     CL,[SI]
  57. OR      CL,CL              ;     Is string NULL?
  58. JZ      01BC               ;     Done if so.
  59. CALL    01AB               ;     Read string.
  60. MOV     CX,AX              ;     CX = # of bytes read.
  61. MOV     AH,02              ;     Function 02H = console output.
  62. CLD                        ;     String instructions forward.
  63. LODSB                      ;0193 Read character.
  64. MOV     DL,AL              ;     DL = character.
  65. INT     21                 ;     Display it.
  66. LOOP    0193               ;     Loop for rest of string.
  67. MOV     AH,09
  68. MOV     DX,0201            ;     Point to CR/LF.
  69. INT     21                 ;     Display it.
  70. JMP     01BC               ;     Close file and return to DOS.
  71. MOV     AX,4200            ;01A3 (Subroutine) Seek from beginning of file.
  72. INT     21                 ;     Call DOS.
  73. JB      01B4               ;     Report error if seek failed.
  74. RET                        ;     Back to caller if successful.
  75. MOV     AH,3F              ;01AB (Subroutine) Read CX bytes from file
  76. MOV     DX,SI              ;     DX -> buffer
  77. INT     21                 ;     Call DOS.
  78. JB      01B4               ;     Skip if read failed.
  79. RET                        ;     Back to caller if successful.
  80. POP     AX                 ;01B4 Clear return address from stack.
  81. MOV     DX,01E3            ;     DX -> error message.
  82. MOV     AH,09              ;     Display string.
  83. INT     21
  84. MOV     AH,3E              ;01BC Close file.
  85. INT     21
  86. JMP     01CE               ;     All Done.
  87. MOV     DX,01D3            ;01C2 DX -> "File not found."
  88. MOV     AH,09              ;     Display it.
  89. INT     21
  90. MOV     DX,0201            ;     DX -> CR/LF
  91. INT     21                 ;     Display it.
  92. MOV     AX,4C00            ;01CE Set ERRORLEVEL to 0.
  93. INT     21                 ;     Back to DOS.
  94.   ;Should be offset 01D3
  95. DB 'File not found.$'
  96.   ;Should be offset 01E3
  97. DB 'Not a Win 3.x executable file.'
  98.   ;Should be offset 0201
  99. DB  0D 0A 24
  100.   ;Should be offset 0204 (start of buffer)
  101.  
  102. rcx
  103. 104
  104. w
  105. q
  106.  
  107.